<?php
/*
 * 文章详情控制器
 * @auth suoge
 */
 namespace Home\Controller;
 use Think\Controller;
 
 class DetailController extends CommonController {
 	
	public function index(){
		$id = intval($_GET['id']);
		if(!$id){
			return $this->error("文章id不存在或非法");
		}
		
		$news = D('News')->getNewsById($id);
		
		if(!$news || $news['status']!=1){
			return $this->error("文章不存在或状态非法");
		}
		$newsContent = D('NewsContent')->getNewsById($id);
		if($newsContent){
			$news['content'] =htmlspecialchars_decode($newsContent['content']);
		}
		$conds = array(
			'status'=>1,
		);
		$this->assign('webSiteMenu',D('Menu')->getBarMenus());
		$this->assign('newslist',D('News')->getNews($conds,1,10));
		$this->assign('news',$news);
		$this->display();
	}
	
	public function zan(){
		
		
	}
	
 }
 
 
